package com.ssm.zyn.tool;

/**
 * 返回类型的所调用的方法
 */
public class Result {
    /**********************正确的提示提供的方法*************************/
    public static ResponseMessage success(String message){
        return new ResponseMessage(ResponseMessageCodeEnum.SUCCESS.getCode(),message,true);
    }
    public static <T> ResponseMessage<T> success(String code,T data){
        return new ResponseMessage(code,"",true,data);
    }
    public static <T> ResponseMessage<T> success(String code,String message){
        return new ResponseMessage(code,message);
    }
    public static <T> ResponseMessage<T> success(String code,String message,T data,boolean ok){
        return new ResponseMessage(code,message,ok,data);
    }
    public static <T>ResponseMessage<T>success(T data){
        return new ResponseMessage(ResponseMessageCodeEnum.SUCCESS.getCode(),"",true,data);
    }




/**********************错误的提示*************************/
    public static ResponseMessage error(String message){
        return new ResponseMessage(ResponseMessageCodeEnum.ERROR.getCode(),message,false);
    }
    public static <T> ResponseMessage<T> error(String code,T data){
        return new ResponseMessage(code,"",false,data);
    }
    public static <T> ResponseMessage<T> error(String code,String message){
        return new ResponseMessage(code,message);
    }
    public static <T> ResponseMessage<T> error(String code,String message,T data,boolean ok){
        return new ResponseMessage(code,message,ok,data);
    }
    public static <T>ResponseMessage<T>error(T data){
        return new ResponseMessage(ResponseMessageCodeEnum.ERROR.getCode(),"",false,data);
    }
}
